<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

  
  <meta content="text/html; charset=ISO-8859-2" http-equiv="content-type">

  
  <title>coidc</title>
</head>


<body>

COID remote console<br>

<br>

<span style="font-family: monospace;"><span style="font-weight: bold;">coidc
</span>[-all] [<span style="font-style: italic;">host:port</span>]</span><br>

<br>

Connects to <span style="font-family: monospace;">localhost:55099</span>
or to the <span style="font-family: monospace;"><span style="font-style: italic;"></span></span>specified <span style="font-family: monospace;"><span style="font-style: italic;">host:port</span></span>.
It requests the <span style="font-family: monospace;">console</span>
service from the COID server, that enables it to browse through the
system
log, filter system log messages and to send commands to the COID server
and objects located therein.<br>

<br>

The remote console allows to create instances of served classes or to
bind to existing instances, and to invoke methods on these objects too.
So for example you can connect to an instance of your C++ class, call a
method, passing in the <span style="font-family: monospace;">in-</span>
and <span style="font-family: monospace;">inout- </span>type
arguments and receiving the <span style="font-family: monospace;">out-
</span>type arguments back, all text formatted. The remote object
doesn't even know the difference between normal call or a method call
from remote console, even though in the first case the communication
goes through a binary stream, while console communicates through a
text-formatting stream. The abstraction is possible thanks to <a href="binstream.html">binstream</a> class.<br>

<br>

There are two types of commands:<br>

- console commands, used to modify console behaviour<br>

- object specific commands, applicable on selected server objects<br>

<br>

Console commands are:<br>

<br>

<table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2">

  <tbody>

    <tr>

      <td style="vertical-align: top; font-family: monospace; font-weight: bold;">quit<br>

q</td>

      <td style="vertical-align: top;">quit console<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace;"><span style="font-weight: bold;">ls</span> [<span style="font-style: italic;">n</span>]<br>

      </td>

      <td style="vertical-align: top;">list child nodes of selected
node (or list childs of node <span style="font-weight: bold;">n</span>)<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top;"><span style="font-family: monospace;"><span style="font-weight: bold;">cd</span><br>

      <span style="font-weight: bold;">cd</span> [<span style="font-style: italic;">n</span>]</span><br>

      </td>

      <td style="vertical-align: top;">change selected node to <span style="font-family: monospace;">ConnectionCoid</span> node of this
console connection or<br>

change selected node to <span style="font-weight: bold;">n</span><br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top;"><span style="font-family: monospace;"><span style="font-weight: bold;">ping</span>
[<span style="font-style: italic;">size</span>]</span><br>

      </td>

      <td style="vertical-align: top;">measure ping time to server,
optionally transfering to and from the specified amount of bytes<br>

      </td>

    </tr>

  
  </tbody>
</table>

<br>

<br>

Any object command may be aimed at multiple objects by preceding
command with path specifier. The path can begin with characters: <span style="font-family: monospace;">. / *</span> or a number (id of
object). The path and command are separated by space or colon
characters.<br>

<br>

<table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2">

  <tbody>

    <tr>

      <td style="vertical-align: top; font-family: monospace; text-align: center; background-color: rgb(153, 255, 153);">path<br>

      </td>

      <td style="vertical-align: top; font-family: monospace; text-align: center; background-color: rgb(153, 255, 153);">selection<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top;"><span style="font-family: monospace;">.</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">..<br>

      <br style="font-family: monospace;">

      </span><span style="font-family: monospace;">/</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">/@server</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">/xyz</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">/xyz@server</span><br style="font-family: monospace;">

      <br style="font-family: monospace;">

      <span style="font-family: monospace;">/@server/</span><br style="font-family: monospace;">

      <br style="font-family: monospace;">

      <span style="font-family: monospace;">*unknown</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">*unknown/</span><br>

      </td>

      <td style="vertical-align: top;"><span style="font-family: monospace;">currently selected device (default
root)</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">parent device<br>

      <br style="font-family: monospace;">

      </span><span style="font-family: monospace;">anything
immediatelly below root</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">anything immediatelly below
root of class server</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">anything immediatelly below
root that has name xyz</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">anything immediatelly below
root of class serverthat has name xyz</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">&nbsp;</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">anything immediatelly below
all objects of classs server living below the root</span><br style="font-family: monospace;">

      <br style="font-family: monospace;">

      <span style="font-family: monospace;">all objects in any level
below currently selected one, that have name 'unknown'</span><br style="font-family: monospace;">

      <span style="font-family: monospace;">anything immediatelly below
all objects in any level under currently selected one that have name
'unknown'</span><br>

      </td>

    </tr>

  
  </tbody>
</table>

<br>

<br>

Object commands are specific to the class of the object, but some are
common in all classes:<br>

<br>

<table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2">

  <tbody>

    <tr>

      <td style="vertical-align: top; text-align: center; background-color: rgb(153, 255, 153);">class<br>

      </td>

      <td style="vertical-align: top; text-align: center; background-color: rgb(153, 255, 153);">command<br>

      </td>

      <td style="vertical-align: top; text-align: center; background-color: rgb(153, 255, 153);">description<br>

      </td>

    </tr>

    <tr>

      <td colspan="1" rowspan="7" style="vertical-align: top; text-align: center; font-family: monospace;">*<br>

      </td>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap;"><span style="font-weight: bold;">help</span>
[<span style="font-style: italic;">cmd</span>]<br>

      </td>

      <td style="vertical-align: top;">print list of commands or
methods or print help for command <span style="font-style: italic;">cmd</span><br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap;"><span style="font-weight: bold;">cid</span><br>

      </td>

      <td style="vertical-align: top;">print id of connection owner node<br>

this is the node that console command <span style="font-family: monospace;">cd </span>without argument changes to<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap; font-weight: bold;">id<br>

      </td>

      <td style="vertical-align: top;">print selected object/node id</td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap; font-weight: bold;">info<br>

      </td>

      <td style="vertical-align: top;">print info about the selected
object</td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap; font-weight: bold;">lodl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <br>

      </td>

      <td style="vertical-align: top;"> list object detach list,
identifiers of objects that would be destroyed if this object is dropped<br>

the objects are listed in the order in which they would be destroyed<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap; font-weight: bold;">lot<br>

      </td>

      <td style="vertical-align: top;">list object threads</td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap; font-weight: bold;">parid<br>

      </td>

      <td style="vertical-align: top;">print parent node id</td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace;"><br>

      </td>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap;"><br>

      </td>

      <td style="vertical-align: top;"><br>

      </td>

    </tr>

    <tr>

      <td colspan="1" rowspan="7" style="vertical-align: top; text-align: center; font-family: monospace;">root<br>

      </td>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap;"><span style="font-weight: bold;">acceptor</span>
restart<br>

      </td>

      <td style="vertical-align: top;">restart coid acceptor<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap;"><span style="font-weight: bold;">drop</span>
ID</td>

      <td style="vertical-align: top;">drop object with id ID<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap;"><span style="font-weight: bold;">find</span>
CLASS [NAME]</td>

      <td style="vertical-align: top;">find&nbsp; objects&nbsp;
of&nbsp; class&nbsp; CLASS, optionally named NAME<br>

      </td>

    </tr>

    <tr>
      <td><code><span style="font-weight: bold;">findi</span> CLASS</code></td>
      <td>find autorun instance of class</td>
    </tr>
    <tr>
      <td><code><span style="font-weight: bold;">finds</span> CLASS</code></td>
      <td>find service object of class</td>
    </tr>
    <tr>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap;"><span style="font-weight: bold;">server</span>
(restart|shutdown)<br>

      </td>

      <td style="vertical-align: top;">restart or shutdown server<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap;"><span style="font-weight: bold;">version</span><br>

      </td>

      <td style="vertical-align: top;">display server version<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top; font-family: monospace;"><br>

      </td>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap;"><br>

      </td>

      <td style="vertical-align: top;"><br>

      </td>

    </tr>

    <tr>

      <td colspan="1" rowspan="2" style="vertical-align: top; text-align: center;"><span style="font-family: monospace;">connection</span><br>

      </td>

      <td style="vertical-align: top; font-family: monospace; white-space: nowrap;"><span style="font-weight: bold;">connect</span>
SERVICENAME<br>

      <span style="font-weight: bold;">connect</span> (-s | --shared)
ID[:NAME]<br>

      <span style="font-weight: bold;">connect</span> (-s | --shared)
SERVICENAME<br>

      </td>

      <td style="vertical-align: top;">Create instance of specified
service <span style="font-family: monospace;">SERVICENAME</span> and
connect it under the <span style="font-family: monospace;">connection </span>object.
Optional arguments to the connect method of the specified service can
be passed after required arguments. With the <span style="font-family: monospace;">-s</span> or <span style="font-family: monospace;">--shared</span> option, the connect
command tries to estabilish a shared connection to an existing object
with id <span style="font-family: monospace;">ID</span> or to an
autospawned object of service <span style="font-family: monospace;">SERVICENAME.</span><br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top;"><span style="font-family: monospace; font-weight: bold;">lsl</span><br>

      </td>

      <td style="vertical-align: top;">list slots (bound services) of
this connection<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top;"><br>

      </td>

      <td style="vertical-align: top;"><br>

      </td>

      <td style="vertical-align: top;"><br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top; text-align: center;"><span style="font-family: monospace;"><span style="font-style: italic;">instance</span></span><br>

      </td>

      <td style="vertical-align: top;"><span style="font-family: monospace; font-weight: bold;">log</span><br>

      </td>

      <td style="vertical-align: top;">enable or disable method logging<br>

      </td>

    </tr>

    <tr>

      <td style="vertical-align: top;"><br>

      </td>

      <td style="vertical-align: top;"><span style="font-family: monospace;">.<span style="font-style: italic;">method</span></span><br>

      </td>

      <td style="vertical-align: top;">calling a method of service; use
      <span style="font-family: monospace;">help</span> command on the
object to get list of methods with parameter description<br>

      </td>

    </tr>

  
  </tbody>
</table>

<br>

As an example we can use one of built-in services in the COID server,
for example AccountMgr. AccountMgr is an ordinary C++ class that was
appropriately decorated in order to be servable by the COID server.
It's started automatically by the COID server and handles user accounts.<br>

<br>

Normally you would need corresponding client to communicate with the
service. But since the communication is done using abstract stream
class <a href="binstream.html">binstream</a>, it's possible to bind a
text-formatting stream to any object on the server. The object doesn't
know the difference, but we can call its methods passing textual
arguments and getting formatted response.<br>

<br>

First we need to find the AccountMgr service instance:<br>

<br>

<span style="font-family: monospace; font-weight: bold;">findi AccountMgr</span><br style="font-family: monospace;">

<span style="font-family: monospace;">6</span><br>

<br>

Now we change the working device to it:<br>

<br>

<span style="font-weight: bold; font-family: monospace;">cd 6</span><br style="font-family: monospace;">

<span style="font-family: monospace;">selected device: AccountMgr&nbsp;
(auto)@AccountMgr (6)</span><br style="font-family: monospace;">

<br>

Now we are working with the instance of AccountMgr service. We can list
methods of the service:<br>

<br>

<span style="font-weight: bold; font-family: monospace;">help</span><br style="font-family: monospace;">

<span style="font-family: monospace;">.add_account</span><br style="font-family: monospace;">

<span style="font-family: monospace;">.del_account</span><br style="font-family: monospace;">

<span style="font-family: monospace;">.find_account</span><br style="font-family: monospace;">

<span style="font-family: monospace;">.list_accounts</span><br style="font-family: monospace;">

<span style="font-family: monospace;">log</span><br style="font-family: monospace;">

<span style="font-family: monospace;">help</span><br style="font-family: monospace;">

<span style="font-family: monospace;">cid</span><br style="font-family: monospace;">

<span style="font-family: monospace;">id</span><br style="font-family: monospace;">

<span style="font-family: monospace;">info</span><br style="font-family: monospace;">

<span style="font-family: monospace;">lodl</span><br style="font-family: monospace;">

<span style="font-family: monospace;">lot</span><br style="font-family: monospace;">

<span style="font-family: monospace;">parid</span><br>

<br>

Entries starting with '<span style="font-family: monospace;">.</span>'
are methods of the class, the other are commands inherited from <span style="font-family: monospace;">ServiceInstanceCoid</span> class and <span style="font-family: monospace;">CoidNode</span> class. We can get more
specific help for particular method or command, for example:<br>

<br>

<span style="font-family: monospace; font-weight: bold;">help
.list_accounts</span><br style="font-family: monospace;">

<span style="font-family: monospace;">.list_accounts [const] OUT:(
dynarray&lt;account&gt; &amp; data )</span><br style="font-family: monospace;">

<br>

- prints method name, qualifiers [const] and IN, INOUT and OUT
arguments. In this case, the method has only OUT type arguments, namely
an array of <span style="font-family: monospace;">account</span>
structures.<br>

Calling <span style="font-family: monospace;">.list_accounts</span>
would yield something like this:<br>

<br>

<span style="font-weight: bold; font-family: monospace;">.list_accounts<br>

</span><span style="font-family: monospace;">OK<br>

[<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"root"<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"*"<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[70 6D 54 CA 7D 58 BE A1 BA 86 CE 44 7C AF 50 9F B9 07 F6 39]<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>

]</span><span style="font-family: monospace;"></span><br style="font-family: monospace;">

<br style="font-family: monospace;">

<span style="font-family: monospace;">16:21:38 ....&nbsp;&nbsp; 6
Account&nbsp; m (3) list_accounts ( ? )&nbsp; --&gt;&nbsp; (root*70 6D
54 CA 7D 58 BE A1 BA 86 CE 44 7C AF 50 9F B9 07 F6 393435973836) .. ok</span><br style="font-family: monospace;">

<br>

First is return value, in this case <a href="opcd_type.html">opcd</a>
0 (no error). Following is list of output values, in this case array
(enclosed in square braces) of <span style="font-family: monospace;">account</span>
structures, each consisting of name, group, password and flags. After
the output appears a line from the COID server log subsystem, logging
the call that has been made to AccountMgr service. We can turn off the
log for this object calling the log command, that is recognized by any
ServiceInstanceCoid object, i.e. an instance of any served class.<br>

<br>

<span style="font-family: monospace; font-weight: bold;">log</span><br style="font-family: monospace; font-weight: bold;">

<span style="font-family: monospace;">method log disabled</span><br style="font-family: monospace;">

<br>

When we called the list_accounts method, there was only one entry, that
for implicit "root" account of the server. We can create more accounts
by calling add_account method. First we look at the arguments:<br>

<br>

<span style="font-family: monospace; font-weight: bold;">help
.add_account</span><br style="font-family: monospace; font-weight: bold;">

<span style="font-family: monospace;">.add_account IN:( const account
&amp; acid, bool modify )</span><br style="font-family: monospace;">

<br>

This method has only input arguments, account structure and flag saying
if we are modifying the account (true) or adding new one (false). Let's
add a new account.<br>

<br>

<span style="font-family: monospace; font-weight: bold;">.add_account {
"joe" "*" $PWD$ 0 } false</span><br style="font-family: monospace; font-weight: bold;">

<span style="font-family: monospace;">password:</span><br style="font-family: monospace;">

<span style="font-family: monospace;">**</span><br style="font-family: monospace;">

<span style="font-family: monospace;">OK</span><br style="font-family: monospace;">

<br>

The $PWD$ construct is catched by the console before the data are sent
to the console service, it allows to ask for passwords without echoing
the characters on the console. Equivalently you could type the hashed
password as an array of 20 numbers straight away :)<br>

Now we call list_accounts again:<br>

<br>

<span style="font-family: monospace; font-weight: bold;">.list_accounts</span><br style="font-family: monospace; font-weight: bold;">

<span style="font-family: monospace;">OK</span><br style="font-family: monospace;">

<span style="font-family: monospace;">[</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"joe"</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"*"</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[70 6D 54 CA 7D 58 BE A1 BA 86 CE 44 7C AF 50 9F B9 07 F6 39]</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span><br style="font-family: monospace;">

<br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"root"</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"*"</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[70 6D 54 CA 7D 58 BE A1 BA 86 CE 44 7C AF 50 9F B9 07 F6 39]</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1</span><br style="font-family: monospace;">

<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span><br style="font-family: monospace;">

<span style="font-family: monospace;">]</span><br>

<br>

Note that list_accounts method doesn't return valid passwords, only
name, group and flags.<br>

<br>

</body>
</html>
